home *** CD-ROM | disk | FTP | other *** search
/ JCSM Shareware Collection 1996 September / JCSM Shareware Collection (JCS Distribution) (September 1996).ISO / prgtools / pbvl010.zip / TUTOR2_4.BAS < prev    next >
BASIC Source File  |  1994-02-10  |  3KB  |  87 lines

  1. '┌─────────────────────────────────────────────────────────────────────────┐
  2. '│    FILE: TUTOR2_4.BAS                                                   │
  3. '│ PURPOSE: PB/VISION(tm) LITE Tutorial Example Program                    │
  4. '├─────────────────────────────────────────────────────────────────────────┤
  5. '│ For instant help on any PB/VISION(tm) keyword, place the cursor on that │
  6. '│ keyword and press <CTRL-F1>.  The PB/VISION(tm) index can be accessed   │
  7. '│ by pressing <SHIFT-F1> twice.  The file "PBVLITE.PBH" _must_ be in the  │
  8. '│ same directory as the PowerBASIC IDE (PB.EXE) for this feature to work  │
  9. '│ properly.                                                               │
  10. '└─────────────────────────────────────────────────────────────────────────┘
  11.  
  12. %ISPBU = 0
  13.  
  14. DEFINT A-Z
  15. $DYNAMIC
  16.  
  17. $INCLUDE ".\WINDOW.BI"
  18. $INCLUDE ".\EVENT.BI"
  19. $INCLUDE ".\MOUSE.BI"                           ' mouse programs require this
  20.  
  21.     %cmQuit = 1001                          ' add a "quit" event
  22.  
  23.     APP.GRAPHICSMODE = 1                    ' adds graphical mapping
  24.     APP.ATTR = &H9F                         ' sets desktop color
  25.     APP.PATTERN = 250                       ' sets desktop fill pattern
  26.  
  27. ' ─ ■ 2.4.1 - SELECTING THE MOUSE CURSOR STYLE ───────────────────────────
  28.  
  29.     APP.GRAPHICSMOUSE = 1
  30.  
  31.     APPTITLE &HF0, "TUTOR2_4.BAS - RODENT CONTROLLED WINDOWS"
  32.  
  33.     APPINIT
  34.  
  35. ' ─ ■ 2.4.2 - MAKING PROGRAMS MOUSE AWARE ────────────────────────────────
  36.  
  37.     gottaRodent = MOUSEINIT(buttons)        ' initialize the critter
  38.     MOUSECURSORON                           ' show the mouse cursor
  39.  
  40. ' ─ ■ 2.4.3 - MAKING WINDOWS MOUSE AWARE ─────────────────────────────────
  41.  
  42.     flags = %SHADOW OR %DRAGBAR OR %RESIZE
  43.  
  44.     AuntEdna = WINOPEN(10, 45, &H1B, 1, &H1F, "AUNT EDNA'S RODENT CONTROLED WINDOW", &HE0, flags)
  45.     UncleBob = WINPOPUP(2, 4, 10, 45, &H4A, 1, &H4F, "UNCLE BOB'S RODENT CONTROLED WINDOW", &HB0, flags)
  46.     CousinWillie = WINPOPUP(10, 30, 10, 45, &H7E, 1, &H7F, "COUSIN WILLIE'S WINDOW", &HA0, flags)
  47.  
  48.     WINSHOW AuntEdna, 0, 0, 25, 80
  49.  
  50.     HOTKEYADD &H2D00, %cmQuit               ' <ALT-X> event
  51.  
  52.     DO
  53.         EventID = GETEVENT(0)
  54.  
  55.         SELECT CASE EventID
  56.  
  57.             CASE 17                 ' "No Event" event
  58.  
  59.             CASE 102, %cmQuit       ' <ESC> or <ALT-X>
  60.                 EXIT DO
  61.  
  62. ' ─ ■ 2.4.4 - RESPONDING TO USE EVENTS ────────────────────────────────────
  63.  
  64.             CASE 202
  65.                 WINWRITELN WINGET, "I'm on top of the world. (event #202)"
  66.  
  67.             CASE 206                ' "move" event
  68.                 WINWRITELN WINGET, "Hey, you really move me. (event #206)"
  69.  
  70.             CASE 207                ' "resize" event
  71.                 WINWRITELN WINGET, "I'm not as big as I used to be. (event #207)"
  72.  
  73.             CASE ELSE               ' Other events
  74.  
  75.         END SELECT
  76.  
  77.  
  78.     LOOP
  79.  
  80.     WINCLOSE AuntEdna
  81.  
  82.     APPCLOSE
  83.  
  84.     END
  85.  
  86.  
  87.